import {
  BwComPropSetConstValueComEnum,
  BwCustomComPropDataTypeEnum,
  BwCustomComEmitParamDataTypeEnum,
  BwCustomComSoltTypeEnum,
  type BwCustomComEmitInfoModel,
  type BwCustomComSlotInfoModel,
  type BwCustomComPropInfoModel,
} from '../../../render/models'

/** 组件属性 */
const comAttrs: Array<BwCustomComPropInfoModel> = [
  {
    key: 'class',
    name: 'classNames',
    isRequire: false,
    defaultValue: undefined,
    dataType: [
      BwCustomComPropDataTypeEnum.string,
      BwCustomComPropDataTypeEnum.array,
    ],
    defaultValueDataType: BwCustomComPropDataTypeEnum.string,
    constValueSetCom: BwComPropSetConstValueComEnum.input,
    constValueSetComProps: null,
    remark: '',
  },
  {
    key: 'allowClear',
    name: '支持清除',
    isRequire: false,
    defaultValue: 'true',
    dataType: [BwCustomComPropDataTypeEnum.boolean],
    defaultValueDataType: BwCustomComPropDataTypeEnum.boolean,
    constValueSetCom: BwComPropSetConstValueComEnum.switch,
    constValueSetComProps: null,
    remark: '',
  },
  {
    key: 'autoFocus',
    name: '自动获取焦点',
    isRequire: false,
    defaultValue: 'false',
    dataType: [BwCustomComPropDataTypeEnum.boolean],
    defaultValueDataType: BwCustomComPropDataTypeEnum.boolean,
    constValueSetCom: BwComPropSetConstValueComEnum.switch,
    constValueSetComProps: null,
    remark: '',
  },
  {
    key: 'bordered',
    name: '是否有边框',
    isRequire: false,
    defaultValue: 'true',
    dataType: [BwCustomComPropDataTypeEnum.boolean],
    defaultValueDataType: BwCustomComPropDataTypeEnum.boolean,
    constValueSetCom: BwComPropSetConstValueComEnum.switch,
    constValueSetComProps: null,
    remark: '',
  },
  {
    key: 'changeOnSelect',
    name: '点选每级菜单选项值都会发生变化',
    isRequire: false,
    defaultValue: 'false',
    dataType: [BwCustomComPropDataTypeEnum.boolean],
    defaultValueDataType: BwCustomComPropDataTypeEnum.boolean,
    constValueSetCom: BwComPropSetConstValueComEnum.switch,
    constValueSetComProps: null,
    remark: '',
  },
  {
    key: 'defaultValue',
    name: '默认的选中项',
    isRequire: false,
    defaultValue: undefined,
    dataType: [BwCustomComPropDataTypeEnum.array],
    defaultValueDataType: BwCustomComPropDataTypeEnum.array,
    constValueSetCom: BwComPropSetConstValueComEnum.textarea,
    constValueSetComProps: null,
    remark: '',
  },
  {
    key: 'disabled',
    name: '禁用',
    isRequire: false,
    defaultValue: 'false',
    dataType: [BwCustomComPropDataTypeEnum.boolean],
    defaultValueDataType: BwCustomComPropDataTypeEnum.boolean,
    constValueSetCom: BwComPropSetConstValueComEnum.switch,
    constValueSetComProps: null,
    remark: '',
  },
  // 函数类型
  // {
  //   key: 'displayRender',
  //   name: '选择后展示的渲染函数,可使用 #displayRender="{labels, selectedOptions}"',
  //   isRequire: false,
  //   defaultValue: undefined,
  //   dataType: [BwCustomComPropDataTypeEnum.object],
  //   defaultValueDataType: BwCustomComPropDataTypeEnum.object,
  //   constValueSetCom: BwComPropSetConstValueComEnum.textarea,
  //   constValueSetComProps: null,
  //   remark: '',
  // },
  {
    key: 'popupClassName',
    name: '自定义浮层类名',
    isRequire: false,
    defaultValue: undefined,
    dataType: [BwCustomComPropDataTypeEnum.string],
    defaultValueDataType: BwCustomComPropDataTypeEnum.string,
    constValueSetCom: BwComPropSetConstValueComEnum.input,
    constValueSetComProps: null,
    remark: '',
  },
  {
    key: 'dropdownStyle',
    name: '自定义浮层样式',
    isRequire: false,
    defaultValue: JSON.stringify({}),
    dataType: [BwCustomComPropDataTypeEnum.object],
    defaultValueDataType: BwCustomComPropDataTypeEnum.object,
    constValueSetCom: BwComPropSetConstValueComEnum.textarea,
    constValueSetComProps: null,
    remark: '',
  },
  {
    key: 'expandTrigger',
    name: '次级菜单的展开方式，可选 "click" "和 "hover"',
    isRequire: false,
    defaultValue: 'click',
    dataType: [BwCustomComPropDataTypeEnum.string],
    defaultValueDataType: BwCustomComPropDataTypeEnum.string,
    constValueSetCom: BwComPropSetConstValueComEnum.select,
    constValueSetComProps: JSON.stringify({
      options: [
        {
          label: '点击触发',
          value: 'click',
        },
        {
          label: '移入出发',
          value: 'hover',
        },
      ],
    }),
    remark: '',
  },
  {
    key: 'fieldNames',
    name: '自定义 options 中 label value children 的字段',
    isRequire: false,
    defaultValue: JSON.stringify({
      label: 'label',
      value: 'value',
      children: 'children',
    }),
    dataType: [BwCustomComPropDataTypeEnum.object],
    defaultValueDataType: BwCustomComPropDataTypeEnum.object,
    constValueSetCom: BwComPropSetConstValueComEnum.textarea,
    constValueSetComProps: null,
    remark: '',
  },
  // 函数
  // {
  //   key: 'getPopupContainer',
  //   name: '菜单渲染父节点。默认渲染到 body 上，如果你遇到菜单滚动定位问题，试试修改为滚动的区域，并相对其定位。',
  //   isRequire: false,
  //   defaultValue: undefined,
  //   dataType: [BwCustomComPropDataTypeEnum.object],
  //   defaultValueDataType: BwCustomComPropDataTypeEnum.object,
  //   constValueSetCom: BwComPropSetConstValueComEnum.textarea,
  //   constValueSetComProps: null,
  //   remark: '',
  // },
  // {
  //   key: 'loadData',
  //   name: '用于动态加载选项，无法与 showSearch 一起使用',
  //   isRequire: false,
  //   defaultValue: undefined,
  //   dataType: [BwCustomComPropDataTypeEnum.function],
  //   defaultValueDataType: BwCustomComPropDataTypeEnum.function,
  //   constValueSetCom: BwComPropSetConstValueComEnum.input,
  //   constValueSetComProps: null,
  //   remark: '',
  // },
  {
    key: 'maxTagCount',
    name: '最多显示多少个 tag，响应式模式会对性能产生损耗',
    isRequire: false,
    defaultValue: undefined,
    dataType: [BwCustomComPropDataTypeEnum.number],
    defaultValueDataType: BwCustomComPropDataTypeEnum.number,
    constValueSetCom: BwComPropSetConstValueComEnum.number,
    constValueSetComProps: null,
    remark: '',
  },
  // {
  //   key: 'maxTagPlaceholder',
  //   name: '隐藏 tag 时显示的内容',
  //   isRequire: false,
  //   defaultValue: undefined,
  //   dataType: [BwCustomComPropDataTypeEnum.function],
  //   defaultValueDataType: BwCustomComPropDataTypeEnum.function,
  //   constValueSetCom: BwComPropSetConstValueComEnum.input,
  //   constValueSetComProps: null,
  //   remark: '',
  // },
  {
    key: 'multiple',
    name: '支持多选节点',
    isRequire: false,
    defaultValue: undefined,
    dataType: [BwCustomComPropDataTypeEnum.boolean],
    defaultValueDataType: BwCustomComPropDataTypeEnum.boolean,
    constValueSetCom: BwComPropSetConstValueComEnum.switch,
    constValueSetComProps: null,
    remark: '',
  },
  {
    key: 'notFoundContent',
    name: '当下拉列表为空时显示的内容',
    isRequire: false,
    defaultValue: 'Not Found',
    dataType: [BwCustomComPropDataTypeEnum.string],
    defaultValueDataType: BwCustomComPropDataTypeEnum.string,
    constValueSetCom: BwComPropSetConstValueComEnum.input,
    constValueSetComProps: null,
    remark: '',
  },
  {
    key: 'open',
    name: '控制浮层显隐',
    isRequire: false,
    defaultValue: undefined,
    dataType: [BwCustomComPropDataTypeEnum.boolean],
    defaultValueDataType: BwCustomComPropDataTypeEnum.boolean,
    constValueSetCom: BwComPropSetConstValueComEnum.switch,
    constValueSetComProps: null,
    remark: '',
  },
  {
    key: 'options',
    name: '可选项数据源',
    isRequire: false,
    defaultValue: undefined,
    dataType: [BwCustomComPropDataTypeEnum.array],
    defaultValueDataType: BwCustomComPropDataTypeEnum.array,
    constValueSetCom: BwComPropSetConstValueComEnum.textarea,
    constValueSetComProps: null,
    remark: '',
  },
  {
    key: 'placeholder',
    name: '输入框占位文本',
    isRequire: false,
    defaultValue: undefined,
    dataType: [BwCustomComPropDataTypeEnum.string],
    defaultValueDataType: BwCustomComPropDataTypeEnum.string,
    constValueSetCom: BwComPropSetConstValueComEnum.input,
    constValueSetComProps: null,
    remark: '',
  },
  {
    key: 'placement',
    name: '浮层预设位置',
    isRequire: false,
    defaultValue: 'bottomLeft',
    dataType: [BwCustomComPropDataTypeEnum.string],
    defaultValueDataType: BwCustomComPropDataTypeEnum.string,
    constValueSetCom: BwComPropSetConstValueComEnum.select,
    constValueSetComProps: JSON.stringify({
      options: [
        {
          label: 'bottomLeft',
          value: 'bottomLeft',
        },
        {
          label: 'bottomRight',
          value: 'bottomRight',
        },
        {
          label: 'topLeft',
          value: 'topLeft',
        },
        {
          label: 'topRight',
          value: 'topRight',
        },
      ],
    }),
    remark: '',
  },
  {
    key: 'showCheckedStrategy',
    name: '定义选中项回填的方式。',
    isRequire: false,
    defaultValue: 'SHOW_PARENT',
    dataType: [BwCustomComPropDataTypeEnum.string],
    defaultValueDataType: BwCustomComPropDataTypeEnum.string,
    constValueSetCom: BwComPropSetConstValueComEnum.select,
    constValueSetComProps: JSON.stringify({
      options: [
        {
          label: 'SHOW_PARENT',
          value: 'SHOW_PARENT',
        },
        {
          label: 'SHOW_CHILD',
          value: 'SHOW_CHILD',
        },
      ],
    }),
    remark: '',
  },
  {
    key: 'searchValue',
    name: '设置搜索的值，需要与 showSearch 配合使用',
    isRequire: false,
    defaultValue: undefined,
    dataType: [BwCustomComPropDataTypeEnum.string],
    defaultValueDataType: BwCustomComPropDataTypeEnum.string,
    constValueSetCom: BwComPropSetConstValueComEnum.input,
    constValueSetComProps: null,
    remark: '',
  },
  {
    key: 'showSearch',
    name: '在选择框中显示搜索框',
    isRequire: false,
    defaultValue: 'false',
    dataType: [
      BwCustomComPropDataTypeEnum.boolean,
      BwCustomComPropDataTypeEnum.object,
    ],
    defaultValueDataType: BwCustomComPropDataTypeEnum.boolean,
    constValueSetCom: BwComPropSetConstValueComEnum.switch,
    constValueSetComProps: null,
    remark: '',
  },
  {
    key: 'status',
    name: '设置校验状态',
    isRequire: false,
    defaultValue: undefined,
    dataType: [BwCustomComPropDataTypeEnum.string],
    defaultValueDataType: BwCustomComPropDataTypeEnum.string,
    constValueSetCom: BwComPropSetConstValueComEnum.select,
    constValueSetComProps: JSON.stringify({
      options: [
        {
          label: 'error',
          value: 'error',
        },
        {
          label: 'warning',
          value: 'warning',
        },
      ],
    }),
    remark: '',
  },
  {
    key: 'size',
    name: '输入框大小',
    isRequire: false,
    defaultValue: 'default',
    dataType: [BwCustomComPropDataTypeEnum.string],
    defaultValueDataType: BwCustomComPropDataTypeEnum.string,
    constValueSetCom: BwComPropSetConstValueComEnum.select,
    constValueSetComProps: JSON.stringify({
      options: [
        {
          label: 'large',
          value: 'large',
        },
        {
          label: 'middle',
          value: 'middle',
        },
        {
          label: 'small',
          value: 'small',
        },
      ],
    }),
    remark: '',
  },
  {
    key: 'suffixIcon',
    name: '自定义的选择框后缀图标',
    isRequire: false,
    defaultValue: undefined,
    dataType: [BwCustomComPropDataTypeEnum.string],
    defaultValueDataType: BwCustomComPropDataTypeEnum.string,
    constValueSetCom: BwComPropSetConstValueComEnum.input,
    constValueSetComProps: null,
    remark: '',
  },
  {
    key: 'value',
    name: '绑定值(v-model)',
    isModel: true,
    isRequire: false,
    defaultValue: undefined,
    dataType: [BwCustomComPropDataTypeEnum.array],
    defaultValueDataType: BwCustomComPropDataTypeEnum.array,
    constValueSetCom: BwComPropSetConstValueComEnum.textarea,
    constValueSetComProps: null,
    remark: '',
  },
]

/** 组件事件 */
const comEmits: Array<BwCustomComEmitInfoModel> = [
  {
    key: 'update:value',
    name: 'update:value',
    isModel: true,
    params: [
      {
        paramKey: 'value',
        paramName: '值',
        paramDataType: BwCustomComEmitParamDataTypeEnum.array,
        remark: '',
      },
    ],
  },
  {
    key: 'change',
    name: '选择完成后的回调',
    params: [
      {
        paramKey: 'value',
        paramName: '值',
        paramDataType: BwCustomComEmitParamDataTypeEnum.string,
        remark: '',
      },
      {
        paramKey: 'selectedOptions',
        paramName: '已选择项',
        paramDataType: BwCustomComEmitParamDataTypeEnum.object,
        remark: '',
      },
    ],
  },
  {
    key: 'dropdownVisibleChange',
    name: '显示/隐藏浮层的回调',
    params: [
      {
        paramKey: 'value',
        paramName: '值',
        paramDataType: BwCustomComEmitParamDataTypeEnum.string,
        remark: '',
      },
    ],
  },
  {
    key: 'search',
    name: '监听搜索，返回输入的值',
    params: [
      {
        paramKey: 'value',
        paramName: '值',
        paramDataType: BwCustomComEmitParamDataTypeEnum.string,
        remark: '',
      },
    ],
  },
]

/** 组件插槽 */
const comSlots: Array<BwCustomComSlotInfoModel> = [
  {
    slotType: BwCustomComSoltTypeEnum.convention,
    conventionSlotInfo: {
      slotCode: 'clearIcon',
      slotName: '自定义的选择框清空图标',
    },
  },
  {
    slotType: BwCustomComSoltTypeEnum.convention,
    conventionSlotInfo: {
      slotCode: 'expandIcon',
      slotName: '自定义次级菜单展开图标',
    },
  },
  {
    slotType: BwCustomComSoltTypeEnum.convention,
    conventionSlotInfo: {
      slotCode: 'maxTagPlaceholder',
      slotName: '隐藏 tag 时显示的内容',
    },
  },
  {
    slotType: BwCustomComSoltTypeEnum.convention,
    conventionSlotInfo: {
      slotCode: 'notFoundContent',
      slotName: '当下拉列表为空时显示的内容',
    },
  },
  {
    slotType: BwCustomComSoltTypeEnum.convention,
    conventionSlotInfo: {
      slotCode: 'removeIcon',
      slotName: '自定义的多选框清除图标',
    },
  },
  {
    slotType: BwCustomComSoltTypeEnum.convention,
    conventionSlotInfo: {
      slotCode: 'suffixIcon',
      slotName: '自定义的选择框后缀图标',
    },
  },
  {
    slotType: BwCustomComSoltTypeEnum.convention,
    conventionSlotInfo: {
      slotCode: 'tagRender',
      slotName: '自定义 tag 内容，多选时生效',
    },
  },
]

export const antCascaderInfo = {
  comAttrs,
  comEmits,
  comSlots,
}
